package com.river.springbootdemo.practice;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author chenxingyu
 * @date 2019/12/19 16:50
 */
public class NumberCheck {
    public static void main(String[] args) {
        List<Integer>  weekNumberList= Arrays.asList(2,4,6,10);
        weekNumberList.sort(Integer::compareTo);
        List<Integer> tempList = new ArrayList<>();
        for (int i = 0;i<weekNumberList.size();i++){
            Integer weekNumber1 = weekNumberList.get(i);
            tempList.add(weekNumber1);
            if (i<weekNumberList.size()-1){
                Integer weekNumber2 = weekNumberList.get(i + 1);
                if (weekNumber2-2==weekNumber1){
                    tempList.add(weekNumber1+1);
                }
            }
        }
        System.out.println(tempList);
    }

    private static void number() {
        System.out.println(4%2==0);
        String s = "";
        System.out.println(s);
        String s1 = s.substring(0, 1);
        String s2 = s.substring(s.length() - 1);
        Integer i1 = new Integer(s1);
        Integer i2 = new Integer(s2);
        List<Integer> array = new ArrayList<>();
        while (i1<=i2){
            array.add(i1++);
        }
        String join = StringUtils.join(array, ",");
        System.out.println(join);
        System.out.println(array);
    }
}
